import java.util.Scanner;
//一串英文，找出最多的字母
public class dancifenxi {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        String str=in.next();
        boolean[] isCount=new boolean[str.length()];
        char c=(char)0;
        int max=0;
        for(int i=0;i<str.length();i++){
            if(!isCount[i]) {
                char temp = str.charAt(i);
                int tempCount = 1;
                int tempIndex = i + 1;
                isCount[i] = true;
                while (tempIndex < str.length() && (tempIndex = str.indexOf(temp, tempIndex)) > 0) {
                    tempCount++;
                    isCount[tempIndex] = true;
                    tempIndex++;
                }
                if (tempCount > max) {
                    c = temp;
                    max = tempCount;
                }
            }
        }
        System.out.println(c);
        System.out.println(max);


    }
}
